﻿#region Using region
using System;
using System.Collections.Generic;
using System.Collections;
using System.Threading;
using System.Collections.Specialized;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.GamerServices;


using JigLibX.Physics;
using JigLibX.Collision;
using JigLibX.Geometry;
using JigLibX.Math;
using JigLibX.Utils;
using sqengine.PhysicObjects;
using JigLibX.Vehicles;
using System.Diagnostics;



using sqengine.Engine;
using sqengine.Components;
using sqengine.Engine.Common;


using SqEngine.Components;
using SqEngine.Audio;
using SqEngine;


using PK3Model;
#endregion

namespace sqengine
{

    partial class sqengine : Microsoft.Xna.Framework.Game
    {

        private void AddBot(string Name, string model, Vector3 rotation, Matrix orientation, Vector3 position, WeaponInfo wp, bool save, string savefilename)
        {

            BotInfo bti = new BotInfo();

            bti.BotName = Name;

            //bti.Orientation = rotation;
            //bti.Position = position;
            bti.Weapon = wp;
            bti.ModelName = model;


            if (save)
                SaveMan.SaveBot(savefilename, bti);

            PK3_Model bot_toadd = new PK3_Model(this, adcontent.LoadPK3Model(model), rotation, position, "AS", wp, adcontent, bti.BotName, bti.BotMessages);

            bot_toadd.BotPlayer.Name = Name;

            Components.Add(bot_toadd);

            BotList.Add(bot_toadd);
        }

        public void RemoveBot(PK3_Model bot)
        {
            this.Components.Remove(bot);
            BotList.Remove(bot);

        }


        private void LoadBot(BotInfo bot)
        {

            PK3_Model bot_toadd = new PK3_Model(this, adcontent.LoadPK3Model(bot.ModelName), new Vector3(90f, 0, 0), new Vector3(1, 1, 1), "", bot.Weapon, adcontent, bot.BotName, bot.BotMessages);

            bot_toadd.BotPlayer.Name = bot.BotName;
            Components.Add(bot_toadd);
            msgs_sys.QuickAdd(bot.BotName + " join the game", Color.BlueViolet, 1000, "");
        }

        private bool CheckBotCollisionSkin(CollisionSkin cs)
        {

            for (int i = 0; i < BotList.Count; i++)
            {
                if (BotList[i].PhysicsSkin == cs)
                    return true;

            }

            return false;

        }
    }
}
